<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>canvas文字</title>
	</head>
	<body>
		<canvas id="myCanvas" width="200" height="130" style="border:1px solid #c3c3c3;">
			
		</canvas>
		<script>
		var c = document.getElementById("myCanvas");
		var ctx = c.getContext("2d");
		//空心
		ctx.strokeStyle="#f00";
		ctx.font = "30px Arial";
		ctx.strokeText("One Room", 10, 50);
		//实心
		ctx.fillStyle="#ff55ff";
		ctx.font = "30px Arial";
		ctx.fillText("你的名字", 10, 100);
		</script>
	</body>
</html>